public class Solution2351 {
    public char repeatedCharacter(String s) {
        int[] f=new int[26];
        for (char c : s.toCharArray()) {
            if (f[c-'a']==1){
                return c;
            }
            f[c-'a']=1;
        }
        return 0;
    }

    public static void main(String[] args) {
        System.out.println(new Solution2351().repeatedCharacter("abccbaacz"));
    }
}
